package Array_Object;

/**
 * ClassName:GoodsTest
 * Package:Array_Object
 * Description:
 *
 * @Author:ZhangXin
 * @Create2023/1/15-11:46
 * @Version:v1.0
 */
public class GoodsTest {
    public static void main(String[] args) {
        //创建数组
        Goods[]arr = new Goods[3];
        Goods g1 = new Goods("001","华为P40",5999.0,100);
        Goods g2 = new Goods("002","华为Nova9",2999.0,150);
        Goods g3 = new Goods("003","华为畅想8",1899.0,251);
        //商品添加到数组中
        arr[0]=g1;
        arr[1]=g2;
        arr[2]=g3;
        for (int i = 0; i < arr.length; i++) {
            Goods goods = arr[i];
            System.out.println(goods.getId()+","+goods.getName()+","+ goods.getPrice()+","+ g1.getCount());
        }
    }
}
